$codeplexdir=$Env:codeplex_edxlsharp_aws
$codeplexdir=$codeplexdir+'\EDXLSharp_AWSRouter'
$netdir=$Env:windir
$netinstall=$netdir+'\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe'
$DESvc=$codeplexdir+'\DEProcessing\bin\Debug\DEProcessing.exe'
$ContentSvc=$codeplexdir+'\ContentProcessing\bin\Debug\ContentProcessing.exe'
$HistorySvc=$codeplexdir+'\HistoryProcessing\bin\Debug\HistoryProcessing.exe'
$ContentFeedSvc=$codeplexdir+'\ContentFeedProcessing\bin\Debug\ContentFeedProcessing.exe'
$CacheDeletionSvc=$codeplexdir+'\StaleCacheDeletionService\bin\Debug\StaleCacheDeletionService.exe'
$DeleteService = 1


# Constants (You could change these, but why?)
$SQSQueueName = "icnet-incomingedxl"
$EDXLDynamoTableName = "EDXLCache"
$ValueListDynamoTableName = "ValueLists"
$RulesDynamoTableName = "Rules"


if($DeleteService -eq 1)
{
	Write-Host $DESvc
	Write-Host $netinstall $DESvc
	taskkill /f /IM DEProcessing.exe
	& $netinstall /u $DESvc

  Write-Host $ContentSvc
	Write-Host $netinstall $ContentSvc
	taskkill /f /IM ContentProcessing.exe
	& $netinstall /u $ContentSvc

  Write-Host $HistorySvc
	Write-Host $netinstall $HistorySvc
	taskkill /f /IM HistoryProcessing.exe
	& $netinstall /u $HistorySvc

  Write-Host $ContentFeedSvc
	Write-Host $netinstall $ContentFeedSvc
	taskkill /f /IM ContentFeedProcessing.exe
	& $netinstall /u $ContentFeedSvc
	
  Write-Host $CacheDeletionSvc
	Write-Host $netinstall $CacheDeletionSvc
	taskkill /f /IM StaleCacheDeletionService.exe
	& $netinstall /u $CacheDeletionSvc
}


<#
$queues = Get-SQSQueue
Write-Host $queues
$found = 0
foreach ($queue in $queues)
{
	if($queue -eq $SQSQueueName)
	{
		$found = 1
		$url = Get-SQSQueueUrl -QueueName $queue
		break
	}
}

if ($found = 1)
{
	Remove-SQSQueue -QueueUrl $url -Force
}

$tables = Get-DDBTables
Write-Host $tables
$found = 0
foreach ($table in $tables)
{
	if ($table -eq $EDXLDynamoTableName)
	{
		$found = 1
		break
	}
}

if ($found = 1)
{
	Remove-DDBTable -TableName $EDXLDynamoTableName -Force
}

$found = 0
foreach ($table in $tables)
{
	if ($table -eq $ValueListDynamoTableName)
	{
		$found = 1
		break
	}
}
if($found -eq 1)
{
	Remove-DDBTable -TableName $ValueListDynamoTableName -Force
}

$found = 0
foreach ($table in $tables)
{
	if ($table -eq $RulesDynamoTableName)
	{
		$found = 1
		break
	}
}
if($found -eq 1)
{
	Remove-DDBTable -TableName $RulesDynamoTableName -Force
}
#>